HAL CORDIC functions ¶
Initialization and de-initialization functions ¶
- group CORDIC_Exported_Functions_Group1
-
This section provides a set of functions to initialize and deinitialize the CORDIC peripheral:
Call the function HAL_CORDIC_Init() to initialize the selected CORDIC handle.
Call the function HAL_CORDIC_DeInit() to deinitialize the selected CORDIC handle.
Functions
-
hal_status_t
HAL_CORDIC_Init
(
hal_cordic_handle_t
*
hcordic
,
hal_cordic_t
instance
)
¶
-
Initialize the HAL CORDIC handle and associate it to an instance of the CORDIC peripheral.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
instance – CORDIC instance.
- Return values :
-
HAL_OK – CORDIC instance has been correctly initialized.
HAL_INVALID_PARAM – Pointer to HAL CORDIC handle is NULL.
-
void
HAL_CORDIC_DeInit
(
hal_cordic_handle_t
*
hcordic
)
¶
-
DeInitialize the CORDIC peripheral.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
- group CORDIC_Exported_Functions_Group1
-
This section provides a set of functions to initialize and deinitialize the CORDIC peripheral:
Call the function HAL_CORDIC_Init() to initialize the selected CORDIC handle.
Call the function HAL_CORDIC_DeInit() to deinitialize the selected CORDIC handle.
Functions
-
hal_status_t
HAL_CORDIC_Init
(
hal_cordic_handle_t
*
hcordic
,
hal_cordic_t
instance
)
-
Initialize the HAL CORDIC handle and associate it to an instance of the CORDIC peripheral.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
instance – CORDIC instance.
- Return values :
-
HAL_OK – CORDIC instance has been correctly initialized.
HAL_INVALID_PARAM – Pointer to HAL CORDIC handle is NULL.
-
void
HAL_CORDIC_DeInit
(
hal_cordic_handle_t
*
hcordic
)
-
DeInitialize the CORDIC peripheral.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
- group CORDIC_Exported_Functions_Group1
-
This section provides a set of functions to initialize and deinitialize the CORDIC peripheral:
Call the function HAL_CORDIC_Init() to initialize the selected CORDIC handle.
Call the function HAL_CORDIC_DeInit() to deinitialize the selected CORDIC handle.
Functions
-
hal_status_t
HAL_CORDIC_Init
(
hal_cordic_handle_t
*
hcordic
,
hal_cordic_t
instance
)
-
Initialize the HAL CORDIC handle and associate it to an instance of the CORDIC peripheral.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
instance – CORDIC instance.
- Return values :
-
HAL_OK – CORDIC instance has been correctly initialized.
HAL_INVALID_PARAM – Pointer to HAL CORDIC handle is NULL.
-
void
HAL_CORDIC_DeInit
(
hal_cordic_handle_t
*
hcordic
)
-
DeInitialize the CORDIC peripheral.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
Configuration functions ¶
- group CORDIC_Exported_Functions_Group2
-
This section provides a set of functions to configure the CORDIC driver:
Call the function HAL_CORDIC_SetConfig() to configure the peripheral before starting the CORDIC driver.
Call the function HAL_CORDIC_GetConfig() to retrieve the configuration.
Call the function HAL_CORDIC_SetFunction() to set the mathematical function.
Call the function HAL_CORDIC_GetFunction() to retrieve the current mathematical function.
Call the function HAL_CORDIC_SetInputWidth() to set the width (16-bit or 32-bit) of the input data.
Call the function HAL_CORDIC_GetInputWidth() to retrieve the current width of the input data.
Call the function HAL_CORDIC_SetOutputWidth() to set the width (16-bit or 32-bit) of the output data.
Call the function HAL_CORDIC_GetOutputWidth() to retrieve the current width of the output data.
Call the function HAL_CORDIC_SetNumberArguments() to set the number of arguments of the function.
Call the function HAL_CORDIC_GetNumberArguments() to retrieve the current number of arguments of the function.
Call the function HAL_CORDIC_SetNumberResults() to set the number of results of the function.
Call the function HAL_CORDIC_GetNumberResults() to retrieve the current number of results.
Call the function HAL_CORDIC_SetPrecision() to set the precision required.
Call the function HAL_CORDIC_GetPrecision() to retrieve the current precision.
Call the function HAL_CORDIC_SetScalingFactor() to set the scaling factor.
Call the function HAL_CORDIC_GetScalingFactor() to retrieve the current scaling factor.
Call the function HAL_CORDIC_SetWriteDMA() to set the DMA channel for writing arguments.
Call the function HAL_CORDIC_SetReadDMA() to set the DMA channel for reading results.
Call the function HAL_CORDIC_GetWriteAddress() to get the address of the input arguments.
Call the function HAL_CORDIC_GetReadAddress() to get the address of the output results.
Functions
-
hal_status_t
HAL_CORDIC_SetConfig
(
hal_cordic_handle_t
*
hcordic
,
const
hal_cordic_config_t
*
p_config
)
¶
-
Configure the CORDIC driver.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_config – Pointer to a hal_cordic_config_t structure.
- Return values :
-
HAL_OK – CORDIC block has been correctly configured.
HAL_INVALID_PARAM – When the p_config pointer is NULL.
-
void
HAL_CORDIC_GetConfig
(
const
hal_cordic_handle_t
*
hcordic
,
hal_cordic_config_t
*
p_config
)
¶
-
Retrieve the CORDIC global configuration.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_config – pointer to hal_cordic_config_t structure.
-
hal_status_t
HAL_CORDIC_SetFunction
(
hal_cordic_handle_t
*
hcordic
,
hal_cordic_function_t
function
)
¶
-
Set the CORDIC function.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
function – The value can be value of hal_cordic_function_t.
- Return values :
-
HAL_OK – CORDIC function was successfully set.
-
hal_cordic_function_t
HAL_CORDIC_GetFunction
(
const
hal_cordic_handle_t
*
hcordic
)
¶
-
Retrieve the current CORDIC function.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t structure.
- Return values :
-
hal_cordic_function_t – CORDIC function.
-
hal_status_t
HAL_CORDIC_SetPrecision
(
const
hal_cordic_handle_t
*
hcordic
,
const
hal_cordic_precision_t
precision
)
¶
-
Set the CORDIC precision in multiple of 4 cycles number.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
precision – The value can be a value of hal_cordic_precision_t.
- Return values :
-
HAL_OK – CORDIC precision was successfully configured.
HAL_INVALID_PARAM – The precision does not match the function requirements.
-
hal_cordic_precision_t
HAL_CORDIC_GetPrecision
(
const
hal_cordic_handle_t
*
hcordic
)
¶
-
Retrieve the CORDIC precision.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
- Return values :
-
hal_cordic_precision_t – CORDIC precision.
-
hal_status_t
HAL_CORDIC_SetScalingFactor
(
const
hal_cordic_handle_t
*
hcordic
,
const
hal_cordic_scaling_factor_t
scaling_factor
)
¶
-
Set the CORDIC scaling factor.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
scaling_factor – The value can be a value of hal_cordic_scaling_factor_t.
- Return values :
-
HAL_OK – CORDIC scaling factor was successfully configured.
HAL_INVALID_PARAM – The scaling_factor does not match the function requirements.
-
hal_cordic_scaling_factor_t
HAL_CORDIC_GetScalingFactor
(
const
hal_cordic_handle_t
*
hcordic
)
¶
-
Retrieve the CORDIC scaling factor.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
- Return values :
-
hal_cordic_scaling_factor_t – CORDIC scaling factor.
-
hal_status_t
HAL_CORDIC_SetInputWidth
(
const
hal_cordic_handle_t
*
hcordic
,
const
hal_cordic_in_width_t
input_width
)
¶
-
Set the CORDIC argument width.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
input_width – The value can be a value of hal_cordic_in_width_t.
- Return values :
-
HAL_OK – Data arguments width was successfully configured.
-
hal_cordic_in_width_t
HAL_CORDIC_GetInputWidth
(
const
hal_cordic_handle_t
*
hcordic
)
¶
-
Retrieve the CORDIC argument width.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
- Return values :
-
hal_cordic_in_width_t – CORDIC argument width.
-
hal_status_t
HAL_CORDIC_SetOutputWidth
(
const
hal_cordic_handle_t
*
hcordic
,
const
hal_cordic_out_width_t
output_width
)
¶
-
Set the CORDIC result width.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
output_width – The value can be a value of hal_cordic_out_width_t.
- Return values :
-
HAL_OK – Results width was successfully configured.
-
hal_cordic_out_width_t
HAL_CORDIC_GetOutputWidth
(
const
hal_cordic_handle_t
*
hcordic
)
¶
-
Retrieve the CORDIC result width.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
- Return values :
-
hal_cordic_out_width_t – CORDIC results width.
-
hal_status_t
HAL_CORDIC_SetNumberArguments
(
const
hal_cordic_handle_t
*
hcordic
,
const
hal_cordic_nb_arg_t
nb_argument
)
¶
-
Set the CORDIC number of arguments expected.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
nb_argument – The value can be a value of hal_cordic_nb_arg_t.
- Return values :
-
HAL_OK – Number of arguments was successfully configured.
-
hal_cordic_nb_arg_t
HAL_CORDIC_GetNumberArguments
(
const
hal_cordic_handle_t
*
hcordic
)
¶
-
Retrieve the CORDIC number of arguments.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
- Return values :
-
hal_cordic_nb_arg_t – CORDIC number of arguments.
-
hal_status_t
HAL_CORDIC_SetNumberResults
(
const
hal_cordic_handle_t
*
hcordic
,
const
hal_cordic_nb_result_t
nb_result
)
¶
-
Set the CORDIC number of results expected.
- Parameters :
-
hcordic – pointer to a hal_cordic_handle_t.
nb_result – The value can be a value of hal_cordic_nb_result_t.
- Return values :
-
HAL_OK – Number of results was successfully configured.
-
hal_cordic_nb_result_t
HAL_CORDIC_GetNumberResults
(
const
hal_cordic_handle_t
*
hcordic
)
¶
-
Retrieve the CORDIC number of results.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
- Return values :
-
HAL – status.
-
volatile
uint32_t
*
HAL_CORDIC_GetWriteAddress
(
const
hal_cordic_handle_t
*
hcordic
)
¶
-
Get the input arguments address. Arguments can be directly driven by a timer or other peripheral such as an ADC.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
- Return values :
-
input – argument address.
-
volatile
uint32_t
*
HAL_CORDIC_GetReadAddress
(
const
hal_cordic_handle_t
*
hcordic
)
¶
-
Get the output results address. results can be directly driven by a timer or other peripheral such as a DAC.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
- Return values :
-
the – output results address.
-
hal_status_t
HAL_CORDIC_SetWriteDMA
(
hal_cordic_handle_t
*
hcordic
,
hal_dma_handle_t
*
hdma_wr
)
¶
-
Set DMA channel for writing arguments.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
hdma_wr – Pointer to a hal_dma_handle_t structure which contains the DMA instance.
- Return values :
-
HAL_OK – The channel has been correctly set.
HAL_INVALID_PARAM – hdma_wr is NULL.
-
hal_status_t
HAL_CORDIC_SetReadDMA
(
hal_cordic_handle_t
*
hcordic
,
hal_dma_handle_t
*
hdma_rd
)
¶
-
Set DMA channel for reading results.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
hdma_rd – Pointer to a hal_dma_handle_t structure which contains the DMA instance.
- Return values :
-
HAL_OK – The channel has been correctly set.
HAL_INVALID_PARAM – hdma_rd is NULL.
- group CORDIC_Exported_Functions_Group2
-
This section provides a set of functions to configure the CORDIC driver:
Call the function HAL_CORDIC_SetConfig() to configure the peripheral before starting the CORDIC driver.
Call the function HAL_CORDIC_GetConfig() to retrieve the configuration.
Call the function HAL_CORDIC_SetFunction() to set the mathematical function.
Call the function HAL_CORDIC_GetFunction() to retrieve the current mathematical function.
Call the function HAL_CORDIC_SetInputWidth() to set the width (16-bit or 32-bit) of the input data.
Call the function HAL_CORDIC_GetInputWidth() to retrieve the current width of the input data.
Call the function HAL_CORDIC_SetOutputWidth() to set the width (16-bit or 32-bit) of the output data.
Call the function HAL_CORDIC_GetOutputWidth() to retrieve the current width of the output data.
Call the function HAL_CORDIC_SetNumberArguments() to set the number of arguments of the function.
Call the function HAL_CORDIC_GetNumberArguments() to retrieve the current number of arguments of the function.
Call the function HAL_CORDIC_SetNumberResults() to set the number of results of the function.
Call the function HAL_CORDIC_GetNumberResults() to retrieve the current number of results.
Call the function HAL_CORDIC_SetPrecision() to set the precision required.
Call the function HAL_CORDIC_GetPrecision() to retrieve the current precision.
Call the function HAL_CORDIC_SetScalingFactor() to set the scaling factor.
Call the function HAL_CORDIC_GetScalingFactor() to retrieve the current scaling factor.
Call the function HAL_CORDIC_SetWriteDMA() to set the DMA channel for writing arguments.
Call the function HAL_CORDIC_SetReadDMA() to set the DMA channel for reading results.
Call the function HAL_CORDIC_GetWriteAddress() to get the address of the input arguments.
Call the function HAL_CORDIC_GetReadAddress() to get the address of the output results.
Functions
-
hal_status_t
HAL_CORDIC_SetConfig
(
hal_cordic_handle_t
*
hcordic
,
const
hal_cordic_config_t
*
p_config
)
-
Configure the CORDIC driver.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_config – Pointer to a hal_cordic_config_t structure.
- Return values :
-
HAL_OK – CORDIC block has been correctly configured.
HAL_INVALID_PARAM – When the p_config pointer is NULL.
-
void
HAL_CORDIC_GetConfig
(
const
hal_cordic_handle_t
*
hcordic
,
hal_cordic_config_t
*
p_config
)
-
Retrieve the CORDIC global configuration.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_config – pointer to hal_cordic_config_t structure.
-
hal_status_t
HAL_CORDIC_SetFunction
(
hal_cordic_handle_t
*
hcordic
,
hal_cordic_function_t
function
)
-
Set the CORDIC function.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
function – The value can be value of hal_cordic_function_t.
- Return values :
-
HAL_OK – CORDIC function was successfully set.
-
hal_cordic_function_t
HAL_CORDIC_GetFunction
(
const
hal_cordic_handle_t
*
hcordic
)
-
Retrieve the current CORDIC function.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t structure.
- Return values :
-
hal_cordic_function_t – CORDIC function.
-
hal_status_t
HAL_CORDIC_SetPrecision
(
const
hal_cordic_handle_t
*
hcordic
,
const
hal_cordic_precision_t
precision
)
-
Set the CORDIC precision in multiple of 4 cycles number.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
precision – The value can be a value of hal_cordic_precision_t.
- Return values :
-
HAL_OK – CORDIC precision was successfully configured.
HAL_INVALID_PARAM – The precision does not match the function requirements.
-
hal_cordic_precision_t
HAL_CORDIC_GetPrecision
(
const
hal_cordic_handle_t
*
hcordic
)
-
Retrieve the CORDIC precision.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
- Return values :
-
hal_cordic_precision_t – CORDIC precision.
-
hal_status_t
HAL_CORDIC_SetScalingFactor
(
const
hal_cordic_handle_t
*
hcordic
,
const
hal_cordic_scaling_factor_t
scaling_factor
)
-
Set the CORDIC scaling factor.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
scaling_factor – The value can be a value of hal_cordic_scaling_factor_t.
- Return values :
-
HAL_OK – CORDIC scaling factor was successfully configured.
HAL_INVALID_PARAM – The scaling_factor does not match the function requirements.
-
hal_cordic_scaling_factor_t
HAL_CORDIC_GetScalingFactor
(
const
hal_cordic_handle_t
*
hcordic
)
-
Retrieve the CORDIC scaling factor.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
- Return values :
-
hal_cordic_scaling_factor_t – CORDIC scaling factor.
-
hal_status_t
HAL_CORDIC_SetInputWidth
(
const
hal_cordic_handle_t
*
hcordic
,
const
hal_cordic_in_width_t
input_width
)
-
Set the CORDIC argument width.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
input_width – The value can be a value of hal_cordic_in_width_t.
- Return values :
-
HAL_OK – Data arguments width was successfully configured.
-
hal_cordic_in_width_t
HAL_CORDIC_GetInputWidth
(
const
hal_cordic_handle_t
*
hcordic
)
-
Retrieve the CORDIC argument width.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
- Return values :
-
hal_cordic_in_width_t – CORDIC argument width.
-
hal_status_t
HAL_CORDIC_SetOutputWidth
(
const
hal_cordic_handle_t
*
hcordic
,
const
hal_cordic_out_width_t
output_width
)
-
Set the CORDIC result width.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
output_width – The value can be a value of hal_cordic_out_width_t.
- Return values :
-
HAL_OK – Results width was successfully configured.
-
hal_cordic_out_width_t
HAL_CORDIC_GetOutputWidth
(
const
hal_cordic_handle_t
*
hcordic
)
-
Retrieve the CORDIC result width.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
- Return values :
-
hal_cordic_out_width_t – CORDIC results width.
-
hal_status_t
HAL_CORDIC_SetNumberArguments
(
const
hal_cordic_handle_t
*
hcordic
,
const
hal_cordic_nb_arg_t
nb_argument
)
-
Set the CORDIC number of arguments expected.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
nb_argument – The value can be a value of hal_cordic_nb_arg_t.
- Return values :
-
HAL_OK – Number of arguments was successfully configured.
-
hal_cordic_nb_arg_t
HAL_CORDIC_GetNumberArguments
(
const
hal_cordic_handle_t
*
hcordic
)
-
Retrieve the CORDIC number of arguments.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
- Return values :
-
hal_cordic_nb_arg_t – CORDIC number of arguments.
-
hal_status_t
HAL_CORDIC_SetNumberResults
(
const
hal_cordic_handle_t
*
hcordic
,
const
hal_cordic_nb_result_t
nb_result
)
-
Set the CORDIC number of results expected.
- Parameters :
-
hcordic – pointer to a hal_cordic_handle_t.
nb_result – The value can be a value of hal_cordic_nb_result_t.
- Return values :
-
HAL_OK – Number of results was successfully configured.
-
hal_cordic_nb_result_t
HAL_CORDIC_GetNumberResults
(
const
hal_cordic_handle_t
*
hcordic
)
-
Retrieve the CORDIC number of results.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
- Return values :
-
HAL – status.
-
volatile
uint32_t
*
HAL_CORDIC_GetWriteAddress
(
const
hal_cordic_handle_t
*
hcordic
)
-
Get the input arguments address. Arguments can be directly driven by a timer or other peripheral such as an ADC.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
- Return values :
-
input – argument address.
-
volatile
uint32_t
*
HAL_CORDIC_GetReadAddress
(
const
hal_cordic_handle_t
*
hcordic
)
-
Get the output results address. results can be directly driven by a timer or other peripheral such as a DAC.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
- Return values :
-
the – output results address.
-
hal_status_t
HAL_CORDIC_SetWriteDMA
(
hal_cordic_handle_t
*
hcordic
,
hal_dma_handle_t
*
hdma_wr
)
-
Set DMA channel for writing arguments.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
hdma_wr – Pointer to a hal_dma_handle_t structure which contains the DMA instance.
- Return values :
-
HAL_OK – The channel has been correctly set.
HAL_INVALID_PARAM – hdma_wr is NULL.
-
hal_status_t
HAL_CORDIC_SetReadDMA
(
hal_cordic_handle_t
*
hcordic
,
hal_dma_handle_t
*
hdma_rd
)
-
Set DMA channel for reading results.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
hdma_rd – Pointer to a hal_dma_handle_t structure which contains the DMA instance.
- Return values :
-
HAL_OK – The channel has been correctly set.
HAL_INVALID_PARAM – hdma_rd is NULL.
- group CORDIC_Exported_Functions_Group2
-
This section provides a set of functions to configure the CORDIC driver:
Call the function HAL_CORDIC_SetConfig() to configure the peripheral before starting the CORDIC driver.
Call the function HAL_CORDIC_GetConfig() to retrieve the configuration.
Call the function HAL_CORDIC_SetFunction() to set the mathematical function.
Call the function HAL_CORDIC_GetFunction() to retrieve the current mathematical function.
Call the function HAL_CORDIC_SetInputWidth() to set the width (16-bit or 32-bit) of the input data.
Call the function HAL_CORDIC_GetInputWidth() to retrieve the current width of the input data.
Call the function HAL_CORDIC_SetOutputWidth() to set the width (16-bit or 32-bit) of the output data.
Call the function HAL_CORDIC_GetOutputWidth() to retrieve the current width of the output data.
Call the function HAL_CORDIC_SetNumberArguments() to set the number of arguments of the function.
Call the function HAL_CORDIC_GetNumberArguments() to retrieve the current number of arguments of the function.
Call the function HAL_CORDIC_SetNumberResults() to set the number of results of the function.
Call the function HAL_CORDIC_GetNumberResults() to retrieve the current number of results.
Call the function HAL_CORDIC_SetPrecision() to set the precision required.
Call the function HAL_CORDIC_GetPrecision() to retrieve the current precision.
Call the function HAL_CORDIC_SetScalingFactor() to set the scaling factor.
Call the function HAL_CORDIC_GetScalingFactor() to retrieve the current scaling factor.
Call the function HAL_CORDIC_SetWriteDMA() to set the DMA channel for writing arguments.
Call the function HAL_CORDIC_SetReadDMA() to set the DMA channel for reading results.
Call the function HAL_CORDIC_GetWriteAddress() to get the address of the input arguments.
Call the function HAL_CORDIC_GetReadAddress() to get the address of the output results.
Functions
-
hal_status_t
HAL_CORDIC_SetConfig
(
hal_cordic_handle_t
*
hcordic
,
const
hal_cordic_config_t
*
p_config
)
-
Configure the CORDIC driver.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_config – Pointer to a hal_cordic_config_t structure.
- Return values :
-
HAL_OK – CORDIC block has been correctly configured.
HAL_INVALID_PARAM – When the p_config pointer is NULL.
-
void
HAL_CORDIC_GetConfig
(
const
hal_cordic_handle_t
*
hcordic
,
hal_cordic_config_t
*
p_config
)
-
Retrieve the CORDIC global configuration.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_config – pointer to hal_cordic_config_t structure.
-
hal_status_t
HAL_CORDIC_SetFunction
(
hal_cordic_handle_t
*
hcordic
,
hal_cordic_function_t
function
)
-
Set the CORDIC function.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
function – The value can be value of hal_cordic_function_t.
- Return values :
-
HAL_OK – CORDIC function was successfully set.
-
hal_cordic_function_t
HAL_CORDIC_GetFunction
(
const
hal_cordic_handle_t
*
hcordic
)
-
Retrieve the current CORDIC function.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t structure.
- Return values :
-
hal_cordic_function_t – CORDIC function.
-
hal_status_t
HAL_CORDIC_SetPrecision
(
const
hal_cordic_handle_t
*
hcordic
,
const
hal_cordic_precision_t
precision
)
-
Set the CORDIC precision in multiple of 4 cycles number.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
precision – The value can be a value of hal_cordic_precision_t.
- Return values :
-
HAL_OK – CORDIC precision was successfully configured.
HAL_INVALID_PARAM – The precision does not match the function requirements.
-
hal_cordic_precision_t
HAL_CORDIC_GetPrecision
(
const
hal_cordic_handle_t
*
hcordic
)
-
Retrieve the CORDIC precision.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
- Return values :
-
hal_cordic_precision_t – CORDIC precision.
-
hal_status_t
HAL_CORDIC_SetScalingFactor
(
const
hal_cordic_handle_t
*
hcordic
,
const
hal_cordic_scaling_factor_t
scaling_factor
)
-
Set the CORDIC scaling factor.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
scaling_factor – The value can be a value of hal_cordic_scaling_factor_t.
- Return values :
-
HAL_OK – CORDIC scaling factor was successfully configured.
HAL_INVALID_PARAM – The scaling_factor does not match the function requirements.
-
hal_cordic_scaling_factor_t
HAL_CORDIC_GetScalingFactor
(
const
hal_cordic_handle_t
*
hcordic
)
-
Retrieve the CORDIC scaling factor.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
- Return values :
-
hal_cordic_scaling_factor_t – CORDIC scaling factor.
-
hal_status_t
HAL_CORDIC_SetInputWidth
(
const
hal_cordic_handle_t
*
hcordic
,
const
hal_cordic_in_width_t
input_width
)
-
Set the CORDIC argument width.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
input_width – The value can be a value of hal_cordic_in_width_t.
- Return values :
-
HAL_OK – Data arguments width was successfully configured.
-
hal_cordic_in_width_t
HAL_CORDIC_GetInputWidth
(
const
hal_cordic_handle_t
*
hcordic
)
-
Retrieve the CORDIC argument width.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
- Return values :
-
hal_cordic_in_width_t – CORDIC argument width.
-
hal_status_t
HAL_CORDIC_SetOutputWidth
(
const
hal_cordic_handle_t
*
hcordic
,
const
hal_cordic_out_width_t
output_width
)
-
Set the CORDIC result width.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
output_width – The value can be a value of hal_cordic_out_width_t.
- Return values :
-
HAL_OK – Results width was successfully configured.
-
hal_cordic_out_width_t
HAL_CORDIC_GetOutputWidth
(
const
hal_cordic_handle_t
*
hcordic
)
-
Retrieve the CORDIC result width.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
- Return values :
-
hal_cordic_out_width_t – CORDIC results width.
-
hal_status_t
HAL_CORDIC_SetNumberArguments
(
const
hal_cordic_handle_t
*
hcordic
,
const
hal_cordic_nb_arg_t
nb_argument
)
-
Set the CORDIC number of arguments expected.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
nb_argument – The value can be a value of hal_cordic_nb_arg_t.
- Return values :
-
HAL_OK – Number of arguments was successfully configured.
-
hal_cordic_nb_arg_t
HAL_CORDIC_GetNumberArguments
(
const
hal_cordic_handle_t
*
hcordic
)
-
Retrieve the CORDIC number of arguments.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
- Return values :
-
hal_cordic_nb_arg_t – CORDIC number of arguments.
-
hal_status_t
HAL_CORDIC_SetNumberResults
(
const
hal_cordic_handle_t
*
hcordic
,
const
hal_cordic_nb_result_t
nb_result
)
-
Set the CORDIC number of results expected.
- Parameters :
-
hcordic – pointer to a hal_cordic_handle_t.
nb_result – The value can be a value of hal_cordic_nb_result_t.
- Return values :
-
HAL_OK – Number of results was successfully configured.
-
hal_cordic_nb_result_t
HAL_CORDIC_GetNumberResults
(
const
hal_cordic_handle_t
*
hcordic
)
-
Retrieve the CORDIC number of results.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
- Return values :
-
HAL – status.
-
volatile
uint32_t
*
HAL_CORDIC_GetWriteAddress
(
const
hal_cordic_handle_t
*
hcordic
)
-
Get the input arguments address. Arguments can be directly driven by a timer or other peripheral such as an ADC.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
- Return values :
-
input – argument address.
-
volatile
uint32_t
*
HAL_CORDIC_GetReadAddress
(
const
hal_cordic_handle_t
*
hcordic
)
-
Get the output results address. results can be directly driven by a timer or other peripheral such as a DAC.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
- Return values :
-
the – output results address.
-
hal_status_t
HAL_CORDIC_SetWriteDMA
(
hal_cordic_handle_t
*
hcordic
,
hal_dma_handle_t
*
hdma_wr
)
-
Set DMA channel for writing arguments.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
hdma_wr – Pointer to a hal_dma_handle_t structure which contains the DMA instance.
- Return values :
-
HAL_OK – The channel has been correctly set.
HAL_INVALID_PARAM – hdma_wr is NULL.
-
hal_status_t
HAL_CORDIC_SetReadDMA
(
hal_cordic_handle_t
*
hcordic
,
hal_dma_handle_t
*
hdma_rd
)
-
Set DMA channel for reading results.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
hdma_rd – Pointer to a hal_dma_handle_t structure which contains the DMA instance.
- Return values :
-
HAL_OK – The channel has been correctly set.
HAL_INVALID_PARAM – hdma_rd is NULL.
Process functions ¶
- group CORDIC_Exported_Functions_Group4
-
This section provides a set of functions for the calculation modes of the CORDIC.
There are four calculation modes:
Blocking mode: Communication is performed in polling mode.
HAL_CORDIC_Calculate() : Perform write and read operations in polling mode.
HAL_CORDIC_CalculateZeroOverhead() : Perform write and read zero-overhead operations in polling mode.
Non-blocking mode functions with interrupts are:
HAL_CORDIC_Calculate_IT() : Perform write and read operations in IT mode.
Non-blocking mode functions with DMA are:
HAL_CORDIC_Write_DMA() : Write input arguments in DMA mode (the corresponding read stream is handled by another peripheral).
HAL_CORDIC_Write_DMA_opt() : Write input arguments in DMA mode and optional interrupt (the corresponding read stream is handled by another peripheral).
HAL_CORDIC_Read_DMA() : Read output results in DMA mode (the corresponding write stream is handled by another peripheral).
HAL_CORDIC_Read_DMA_opt() : Read output results in DMA mode and optional interrupt (the corresponding read stream is handled by another peripheral).
HAL_CORDIC_Calculate_DMA() : Perform a write and read operations in DMA mode.
Note that some functions require one or two arguments for the selected calculation function. The list hereafter summarizes the number of arguments needed by each function of the CORDIC IP driver.
Cosine 2 arguments
Sine 2 arguments
Phase 2 arguments
Modulus 2 arguments
Arctangent 1 argument
Hyperbolic cosine 1 argument
Hyperbolic sine 1 argument
Hyperbolic arctangent 1 argument
natural logarithm 1 argument
Square root 1 argument
Keep in mind that invoking a function that requires two arguments and setting only one argument can generate erroneous results. To prevent that case, set the unused argument to the default value +1 (0x7FFFFFFF).
Remember that some functions require a scaling factor to produce correct results. Refer to the reference manual to configure the required parameters correctly for the selected functions.
Functions
-
hal_status_t
HAL_CORDIC_Calculate
(
hal_cordic_handle_t
*
hcordic
,
const
hal_cordic_buffer_desc_t
*
p_in_buff
,
const
hal_cordic_buffer_desc_t
*
p_out_buff
,
uint32_t
timeout_ms
)
¶
-
Perform CORDIC processing in polling mode, according to the existing CORDIC configuration.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_in_buff – Pointer to buffer descriptor containing pointer to the input data buffer and the buffer size.
p_out_buff – Pointer to buffer descriptor containing pointer to the output data buffer and the buffer size.
timeout_ms – Specify timeout value in milliseconds.
- Return values :
-
HAL_OK – Operation completed successfully.
HAL_TIMEOUT – Operation cancelled due to timeout.
HAL_BUSY – Concurrent process ongoing.
HAL_INVALID_PARAM – Invalid parameter.
-
hal_status_t
HAL_CORDIC_CalculateZeroOverhead
(
hal_cordic_handle_t
*
hcordic
,
const
hal_cordic_buffer_desc_t
*
p_in_buff
,
const
hal_cordic_buffer_desc_t
*
p_out_buff
,
uint32_t
timeout_ms
)
¶
-
Perform CORDIC processing in Zero-Overhead mode (output data being read. soon as input data are written), according to the existing CORDIC configuration.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_in_buff – Pointer to buffer descriptor containing pointer to the input data buffer and the buffer size.
p_out_buff – Pointer to buffer descriptor containing pointer to the output data buffer and the buffer size.
timeout_ms – Specify timeout value in milliseconds.
- Return values :
-
HAL_OK – Operation completed successfully.
HAL_TIMEOUT – Operation cancelled due to timeout.
HAL_BUSY – Concurrent process ongoing.
-
hal_status_t
HAL_CORDIC_Calculate_IT
(
hal_cordic_handle_t
*
hcordic
,
const
hal_cordic_buffer_desc_t
*
p_in_buff
,
const
hal_cordic_buffer_desc_t
*
p_out_buff
)
¶
-
Perform CORDIC processing in interrupt mode, according to the existing CORDIC configuration.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_in_buff – Pointer to buffer descriptor containing pointer to the input data buffer and the buffer size.
p_out_buff – Pointer to buffer descriptor containing pointer to the output data buffer and the buffer size.
- Return values :
-
HAL_OK – Operation completed successfully.
HAL_BUSY – Concurrent process ongoing.
-
hal_status_t
HAL_CORDIC_Write_DMA
(
hal_cordic_handle_t
*
hcordic
,
const
hal_cordic_buffer_desc_t
*
p_in_buff
)
¶
-
Write input arguments in DMA mode.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t
p_in_buff – Pointer to buffer descriptor containing pointer to the input data buffer and the buffer size.
- Return values :
-
HAL_OK – Operation completed successfully.
HAL_ERROR – Operation completed with error.
HAL_BUSY – Concurrent process ongoing.
HAL_INVALID_PARAM – Invalid parameter.
-
hal_status_t
HAL_CORDIC_Write_DMA_opt
(
hal_cordic_handle_t
*
hcordic
,
const
hal_cordic_buffer_desc_t
*
p_in_buff
,
uint32_t
opt_it
)
¶
-
Write input arguments in DMA mode with option. Global state must be IDLE.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_in_buff – Pointer to input data descriptor: pointer to data and input size in word.
opt_it – Optional interruption can be a combination of HAL_CORDIC_OPT_DMA_NONE HAL_CORDIC_OPT_DMA_IT_HALF_CPLT.
- Return values :
-
HAL_OK – Operation completed successfully.
HAL_ERROR – Operation completed with error.
HAL_BUSY – Concurrent process ongoing.
HAL_INVALID_PARAM – Invalid parameter.
-
hal_status_t
HAL_CORDIC_Read_DMA
(
hal_cordic_handle_t
*
hcordic
,
hal_cordic_buffer_desc_t
*
p_out_buff
)
¶
-
Read output results in DMA mode.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_out_buff – Pointer to buffer descriptor containing pointer to the output data buffer and the buffer size.
- Return values :
-
HAL_OK – Operation completed successfully.
HAL_ERROR – Operation completed with error.
HAL_BUSY – Concurrent process ongoing.
HAL_INVALID_PARAM – Invalid parameter.
-
hal_status_t
HAL_CORDIC_Read_DMA_opt
(
hal_cordic_handle_t
*
hcordic
,
hal_cordic_buffer_desc_t
*
p_out_buff
,
uint32_t
opt_it
)
¶
-
Read output result in DMA mode. Global state must be IDLE.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_out_buff – Pointer to output data descriptor: pointer to data and output size in word.
opt_it – Optional interruption can be a combination of the following values:
- Return values :
-
HAL_OK – Operation completed successfully.
HAL_ERROR – Operation completed with error.
HAL_BUSY – Concurrent process ongoing.
HAL_INVALID_PARAM – Invalid parameter.
-
hal_status_t
HAL_CORDIC_Calculate_DMA
(
hal_cordic_handle_t
*
hcordic
,
const
hal_cordic_buffer_desc_t
*
p_in_buff
,
hal_cordic_buffer_desc_t
*
p_out_buff
)
¶
-
Perform input data and output data of CORDIC processing in DMA mode according to the existing CORDIC configuration.
Note
p_in_buff and output_buffer buffers must be 32-bit aligned to ensure a correct DMA transfer to and from the Peripheral. The function requires to configure the 2 DMA channels (Input and Output).
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_in_buff – Pointer to buffer descriptor containing pointer to the input data buffer and the buffer size.
p_out_buff – Pointer to buffer descriptor containing pointer to the output data buffer and the buffer size.
- Return values :
-
HAL_OK – Operation completed successfully.
HAL_INVALID_PARAM – Invalid parameter.
HAL_ERROR – Operation error.
HAL_BUSY – Concurrent process ongoing.
-
hal_status_t
HAL_CORDIC_Abort
(
hal_cordic_handle_t
*
hcordic
)
¶
-
Abort the ongoing transfer (blocking process).
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
- Return values :
-
HAL_OK – Operation completed successfully.
-
hal_status_t
HAL_CORDIC_Abort_IT
(
hal_cordic_handle_t
*
hcordic
)
¶
-
Abort a CORDIC process (non-blocking process).
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
- Return values :
-
HAL_OK – Operation completed successfully.
- group CORDIC_Exported_Functions_Group4
-
This section provides a set of functions for the calculation modes of the CORDIC.
There are four calculation modes:
Blocking mode: Communication is performed in polling mode.
HAL_CORDIC_Calculate() : Perform write and read operations in polling mode.
HAL_CORDIC_CalculateZeroOverhead() : Perform write and read zero-overhead operations in polling mode.
Non-blocking mode functions with interrupts are:
HAL_CORDIC_Calculate_IT() : Perform write and read operations in IT mode.
Non-blocking mode functions with DMA are:
HAL_CORDIC_Write_DMA() : Write input arguments in DMA mode (the corresponding read stream is handled by another peripheral).
HAL_CORDIC_Write_DMA_opt() : Write input arguments in DMA mode and optional interrupt (the corresponding read stream is handled by another peripheral).
HAL_CORDIC_Read_DMA() : Read output results in DMA mode (the corresponding write stream is handled by another peripheral).
HAL_CORDIC_Read_DMA_opt() : Read output results in DMA mode and optional interrupt (the corresponding read stream is handled by another peripheral).
HAL_CORDIC_Calculate_DMA() : Perform a write and read operations in DMA mode.
Note that some functions require one or two arguments for the selected calculation function. The list hereafter summarizes the number of arguments needed by each function of the CORDIC IP driver.
Cosine 2 arguments
Sine 2 arguments
Phase 2 arguments
Modulus 2 arguments
Arctangent 1 argument
Hyperbolic cosine 1 argument
Hyperbolic sine 1 argument
Hyperbolic arctangent 1 argument
natural logarithm 1 argument
Square root 1 argument
Keep in mind that invoking a function that requires two arguments and setting only one argument can generate erroneous results. To prevent that case, set the unused argument to the default value +1 (0x7FFFFFFF).
Remember that some functions require a scaling factor to produce correct results. Refer to the reference manual to configure the required parameters correctly for the selected functions.
Functions
-
hal_status_t
HAL_CORDIC_Calculate
(
hal_cordic_handle_t
*
hcordic
,
const
hal_cordic_buffer_desc_t
*
p_in_buff
,
const
hal_cordic_buffer_desc_t
*
p_out_buff
,
uint32_t
timeout_ms
)
-
Perform CORDIC processing in polling mode, according to the existing CORDIC configuration.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_in_buff – Pointer to buffer descriptor containing pointer to the input data buffer and the buffer size.
p_out_buff – Pointer to buffer descriptor containing pointer to the output data buffer and the buffer size.
timeout_ms – Specify timeout value in milliseconds.
- Return values :
-
HAL_OK – Operation completed successfully.
HAL_TIMEOUT – Operation cancelled due to timeout.
HAL_BUSY – Concurrent process ongoing.
HAL_INVALID_PARAM – Invalid parameter.
-
hal_status_t
HAL_CORDIC_CalculateZeroOverhead
(
hal_cordic_handle_t
*
hcordic
,
const
hal_cordic_buffer_desc_t
*
p_in_buff
,
const
hal_cordic_buffer_desc_t
*
p_out_buff
,
uint32_t
timeout_ms
)
-
Perform CORDIC processing in Zero-Overhead mode (output data being read. soon as input data are written), according to the existing CORDIC configuration.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_in_buff – Pointer to buffer descriptor containing pointer to the input data buffer and the buffer size.
p_out_buff – Pointer to buffer descriptor containing pointer to the output data buffer and the buffer size.
timeout_ms – Specify timeout value in milliseconds.
- Return values :
-
HAL_OK – Operation completed successfully.
HAL_TIMEOUT – Operation cancelled due to timeout.
HAL_BUSY – Concurrent process ongoing.
-
hal_status_t
HAL_CORDIC_Calculate_IT
(
hal_cordic_handle_t
*
hcordic
,
const
hal_cordic_buffer_desc_t
*
p_in_buff
,
const
hal_cordic_buffer_desc_t
*
p_out_buff
)
-
Perform CORDIC processing in interrupt mode, according to the existing CORDIC configuration.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_in_buff – Pointer to buffer descriptor containing pointer to the input data buffer and the buffer size.
p_out_buff – Pointer to buffer descriptor containing pointer to the output data buffer and the buffer size.
- Return values :
-
HAL_OK – Operation completed successfully.
HAL_BUSY – Concurrent process ongoing.
-
hal_status_t
HAL_CORDIC_Write_DMA
(
hal_cordic_handle_t
*
hcordic
,
const
hal_cordic_buffer_desc_t
*
p_in_buff
)
-
Write input arguments in DMA mode.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t
p_in_buff – Pointer to buffer descriptor containing pointer to the input data buffer and the buffer size.
- Return values :
-
HAL_OK – Operation completed successfully.
HAL_ERROR – Operation completed with error.
HAL_BUSY – Concurrent process ongoing.
HAL_INVALID_PARAM – Invalid parameter.
-
hal_status_t
HAL_CORDIC_Write_DMA_opt
(
hal_cordic_handle_t
*
hcordic
,
const
hal_cordic_buffer_desc_t
*
p_in_buff
,
uint32_t
opt_it
)
-
Write input arguments in DMA mode with option. Global state must be IDLE.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_in_buff – Pointer to input data descriptor: pointer to data and input size in word.
opt_it – Optional interruption can be a combination of HAL_CORDIC_OPT_DMA_NONE HAL_CORDIC_OPT_DMA_IT_HALF_CPLT.
- Return values :
-
HAL_OK – Operation completed successfully.
HAL_ERROR – Operation completed with error.
HAL_BUSY – Concurrent process ongoing.
HAL_INVALID_PARAM – Invalid parameter.
-
hal_status_t
HAL_CORDIC_Read_DMA
(
hal_cordic_handle_t
*
hcordic
,
hal_cordic_buffer_desc_t
*
p_out_buff
)
-
Read output results in DMA mode.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_out_buff – Pointer to buffer descriptor containing pointer to the output data buffer and the buffer size.
- Return values :
-
HAL_OK – Operation completed successfully.
HAL_ERROR – Operation completed with error.
HAL_BUSY – Concurrent process ongoing.
HAL_INVALID_PARAM – Invalid parameter.
-
hal_status_t
HAL_CORDIC_Read_DMA_opt
(
hal_cordic_handle_t
*
hcordic
,
hal_cordic_buffer_desc_t
*
p_out_buff
,
uint32_t
opt_it
)
-
Read output result in DMA mode. Global state must be IDLE.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_out_buff – Pointer to output data descriptor: pointer to data and output size in word.
opt_it – Optional interruption can be a combination of the following values:
- Return values :
-
HAL_OK – Operation completed successfully.
HAL_ERROR – Operation completed with error.
HAL_BUSY – Concurrent process ongoing.
HAL_INVALID_PARAM – Invalid parameter.
-
hal_status_t
HAL_CORDIC_Calculate_DMA
(
hal_cordic_handle_t
*
hcordic
,
const
hal_cordic_buffer_desc_t
*
p_in_buff
,
hal_cordic_buffer_desc_t
*
p_out_buff
)
-
Perform input data and output data of CORDIC processing in DMA mode according to the existing CORDIC configuration.
Note
p_in_buff and output_buffer buffers must be 32-bit aligned to ensure a correct DMA transfer to and from the Peripheral. The function requires to configure the 2 DMA channels (Input and Output).
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_in_buff – Pointer to buffer descriptor containing pointer to the input data buffer and the buffer size.
p_out_buff – Pointer to buffer descriptor containing pointer to the output data buffer and the buffer size.
- Return values :
-
HAL_OK – Operation completed successfully.
HAL_INVALID_PARAM – Invalid parameter.
HAL_ERROR – Operation error.
HAL_BUSY – Concurrent process ongoing.
-
hal_status_t
HAL_CORDIC_Abort
(
hal_cordic_handle_t
*
hcordic
)
-
Abort the ongoing transfer (blocking process).
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
- Return values :
-
HAL_OK – Operation completed successfully.
-
hal_status_t
HAL_CORDIC_Abort_IT
(
hal_cordic_handle_t
*
hcordic
)
-
Abort a CORDIC process (non-blocking process).
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
- Return values :
-
HAL_OK – Operation completed successfully.
- group CORDIC_Exported_Functions_Group4
-
This section provides a set of functions for the calculation modes of the CORDIC.
There are four calculation modes:
Blocking mode: Communication is performed in polling mode.
HAL_CORDIC_Calculate() : Perform write and read operations in polling mode.
HAL_CORDIC_CalculateZeroOverhead() : Perform write and read zero-overhead operations in polling mode.
Non-blocking mode functions with interrupts are:
HAL_CORDIC_Calculate_IT() : Perform write and read operations in IT mode.
Non-blocking mode functions with DMA are:
HAL_CORDIC_Write_DMA() : Write input arguments in DMA mode (the corresponding read stream is handled by another peripheral).
HAL_CORDIC_Write_DMA_opt() : Write input arguments in DMA mode and optional interrupt (the corresponding read stream is handled by another peripheral).
HAL_CORDIC_Read_DMA() : Read output results in DMA mode (the corresponding write stream is handled by another peripheral).
HAL_CORDIC_Read_DMA_opt() : Read output results in DMA mode and optional interrupt (the corresponding read stream is handled by another peripheral).
HAL_CORDIC_Calculate_DMA() : Perform a write and read operations in DMA mode.
Note that some functions require one or two arguments for the selected calculation function. The list hereafter summarizes the number of arguments needed by each function of the CORDIC IP driver.
Cosine 2 arguments
Sine 2 arguments
Phase 2 arguments
Modulus 2 arguments
Arctangent 1 argument
Hyperbolic cosine 1 argument
Hyperbolic sine 1 argument
Hyperbolic arctangent 1 argument
natural logarithm 1 argument
Square root 1 argument
Keep in mind that invoking a function that requires two arguments and setting only one argument can generate erroneous results. To prevent that case, set the unused argument to the default value +1 (0x7FFFFFFF).
Remember that some functions require a scaling factor to produce correct results. Refer to the reference manual to configure the required parameters correctly for the selected functions.
Functions
-
hal_status_t
HAL_CORDIC_Calculate
(
hal_cordic_handle_t
*
hcordic
,
const
hal_cordic_buffer_desc_t
*
p_in_buff
,
const
hal_cordic_buffer_desc_t
*
p_out_buff
,
uint32_t
timeout_ms
)
-
Perform CORDIC processing in polling mode, according to the existing CORDIC configuration.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_in_buff – Pointer to buffer descriptor containing pointer to the input data buffer and the buffer size.
p_out_buff – Pointer to buffer descriptor containing pointer to the output data buffer and the buffer size.
timeout_ms – Specify timeout value in milliseconds.
- Return values :
-
HAL_OK – Operation completed successfully.
HAL_TIMEOUT – Operation cancelled due to timeout.
HAL_BUSY – Concurrent process ongoing.
HAL_INVALID_PARAM – Invalid parameter.
-
hal_status_t
HAL_CORDIC_CalculateZeroOverhead
(
hal_cordic_handle_t
*
hcordic
,
const
hal_cordic_buffer_desc_t
*
p_in_buff
,
const
hal_cordic_buffer_desc_t
*
p_out_buff
,
uint32_t
timeout_ms
)
-
Perform CORDIC processing in Zero-Overhead mode (output data being read. soon as input data are written), according to the existing CORDIC configuration.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_in_buff – Pointer to buffer descriptor containing pointer to the input data buffer and the buffer size.
p_out_buff – Pointer to buffer descriptor containing pointer to the output data buffer and the buffer size.
timeout_ms – Specify timeout value in milliseconds.
- Return values :
-
HAL_OK – Operation completed successfully.
HAL_TIMEOUT – Operation cancelled due to timeout.
HAL_BUSY – Concurrent process ongoing.
-
hal_status_t
HAL_CORDIC_Calculate_IT
(
hal_cordic_handle_t
*
hcordic
,
const
hal_cordic_buffer_desc_t
*
p_in_buff
,
const
hal_cordic_buffer_desc_t
*
p_out_buff
)
-
Perform CORDIC processing in interrupt mode, according to the existing CORDIC configuration.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_in_buff – Pointer to buffer descriptor containing pointer to the input data buffer and the buffer size.
p_out_buff – Pointer to buffer descriptor containing pointer to the output data buffer and the buffer size.
- Return values :
-
HAL_OK – Operation completed successfully.
HAL_BUSY – Concurrent process ongoing.
-
hal_status_t
HAL_CORDIC_Write_DMA
(
hal_cordic_handle_t
*
hcordic
,
const
hal_cordic_buffer_desc_t
*
p_in_buff
)
-
Write input arguments in DMA mode.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t
p_in_buff – Pointer to buffer descriptor containing pointer to the input data buffer and the buffer size.
- Return values :
-
HAL_OK – Operation completed successfully.
HAL_ERROR – Operation completed with error.
HAL_BUSY – Concurrent process ongoing.
HAL_INVALID_PARAM – Invalid parameter.
-
hal_status_t
HAL_CORDIC_Write_DMA_opt
(
hal_cordic_handle_t
*
hcordic
,
const
hal_cordic_buffer_desc_t
*
p_in_buff
,
uint32_t
opt_it
)
-
Write input arguments in DMA mode with option. Global state must be IDLE.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_in_buff – Pointer to input data descriptor: pointer to data and input size in word.
opt_it – Optional interruption can be a combination of HAL_CORDIC_OPT_DMA_NONE HAL_CORDIC_OPT_DMA_IT_HALF_CPLT.
- Return values :
-
HAL_OK – Operation completed successfully.
HAL_ERROR – Operation completed with error.
HAL_BUSY – Concurrent process ongoing.
HAL_INVALID_PARAM – Invalid parameter.
-
hal_status_t
HAL_CORDIC_Read_DMA
(
hal_cordic_handle_t
*
hcordic
,
hal_cordic_buffer_desc_t
*
p_out_buff
)
-
Read output results in DMA mode.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_out_buff – Pointer to buffer descriptor containing pointer to the output data buffer and the buffer size.
- Return values :
-
HAL_OK – Operation completed successfully.
HAL_ERROR – Operation completed with error.
HAL_BUSY – Concurrent process ongoing.
HAL_INVALID_PARAM – Invalid parameter.
-
hal_status_t
HAL_CORDIC_Read_DMA_opt
(
hal_cordic_handle_t
*
hcordic
,
hal_cordic_buffer_desc_t
*
p_out_buff
,
uint32_t
opt_it
)
-
Read output result in DMA mode. Global state must be IDLE.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_out_buff – Pointer to output data descriptor: pointer to data and output size in word.
opt_it – Optional interruption can be a combination of the following values:
- Return values :
-
HAL_OK – Operation completed successfully.
HAL_ERROR – Operation completed with error.
HAL_BUSY – Concurrent process ongoing.
HAL_INVALID_PARAM – Invalid parameter.
-
hal_status_t
HAL_CORDIC_Calculate_DMA
(
hal_cordic_handle_t
*
hcordic
,
const
hal_cordic_buffer_desc_t
*
p_in_buff
,
hal_cordic_buffer_desc_t
*
p_out_buff
)
-
Perform input data and output data of CORDIC processing in DMA mode according to the existing CORDIC configuration.
Note
p_in_buff and output_buffer buffers must be 32-bit aligned to ensure a correct DMA transfer to and from the Peripheral. The function requires to configure the 2 DMA channels (Input and Output).
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_in_buff – Pointer to buffer descriptor containing pointer to the input data buffer and the buffer size.
p_out_buff – Pointer to buffer descriptor containing pointer to the output data buffer and the buffer size.
- Return values :
-
HAL_OK – Operation completed successfully.
HAL_INVALID_PARAM – Invalid parameter.
HAL_ERROR – Operation error.
HAL_BUSY – Concurrent process ongoing.
-
hal_status_t
HAL_CORDIC_Abort
(
hal_cordic_handle_t
*
hcordic
)
-
Abort the ongoing transfer (blocking process).
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
- Return values :
-
HAL_OK – Operation completed successfully.
-
hal_status_t
HAL_CORDIC_Abort_IT
(
hal_cordic_handle_t
*
hcordic
)
-
Abort a CORDIC process (non-blocking process).
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
- Return values :
-
HAL_OK – Operation completed successfully.
IRQHandler and Callbacks functions ¶
- group CORDIC_Exported_Functions_Group5
-
This section provides functions to:
Handle the CORDIC interrupt request with HAL_CORDIC_IRQHandler().
There are two ways to use callbacks: override weak callback functions or register user callback functions. They are used to indicate:
When all the computations are done (HAL_CORDIC_CalculateCpltCallback() or callback function registered with HAL_CORDIC_RegisterCalculateCpltCallback()).
When half of all the computations are read (HAL_CORDIC_ReadHalfCpltCallback() or callback function registered with HAL_CORDIC_RegisterReadHalfCpltCallback()).
When all the data have been written (HAL_CORDIC_WriteCpltCallback() or callback function registered with HAL_CORDIC_RegisterWriteCpltCallback()).
When half of all the data have been written (HAL_CORDIC_WriteHalfCpltCallback() or callback function registered with HAL_CORDIC_RegisterWriteHalfCpltCallback()).
When the abort is complete (HAL_CORDIC_AbortCpltCallback() or callback function registered with HAL_CORDIC_RegisterAbortCpltCallback()).
When an error occurs in the CORDIC driver (HAL_CORDIC_ErrorCallback() or callback function registered with HAL_CORDIC_RegisterErrorCallback()).
Depending on the process function you use, different callbacks might be triggered:
Process API
\
CallbacksHAL_CORDIC_Calculate_IT
HAL_CORDIC_CalculateCpltCallback
x
HAL_CORDIC_ErrorCallback
x
Process API
\
CallbacksHAL_CORDIC_Calculate_DMA
HAL_CORDIC_Write_DMA
HAL_CORDIC_Read_DMA
HAL_CORDIC_CalculateCpltCallback
x
x
HAL_CORDIC_WriteCpltCallback
x
x
HAL_CORDIC_ErrorCallback
x
x
x
Process API
\
CallbacksHAL_CORDIC_Write_DMA_opt
HAL_CORDIC_Read_DMA_opt
HAL_CORDIC_CalculateCpltCallback
x
HAL_CORDIC_WriteCpltCallback
x
HAL_CORDIC_ReadHalfCpltCallback*
x
HAL_CORDIC_WriteHalfCpltCallback*
x
HAL_CORDIC_ErrorCallback
x
x
Process API
\
CallbacksHAL_CORDIC_Abort_IT
HAL_CORDIC_AbortCpltCallback
x
Note
with HAL_CORDIC_OPT_DMA_IT_HALF_CPLT argument value for interrupts parameter
Functions
-
void
HAL_CORDIC_IRQHandler
(
hal_cordic_handle_t
*
hcordic
)
¶
-
Handle CORDIC interrupt request.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
-
void
HAL_CORDIC_ErrorCallback
(
hal_cordic_handle_t
*
hcordic
)
¶
-
CORDIC error callback.
Warning
This weak function must not be modified. When the callback is needed, it is overridden in the user file.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
-
void
HAL_CORDIC_CalculateCpltCallback
(
hal_cordic_handle_t
*
hcordic
)
¶
-
CORDIC calculate complete callback.
Warning
This weak function must not be modified. When the callback is needed, it is overridden in the user file.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
-
void
HAL_CORDIC_WriteHalfCpltCallback
(
hal_cordic_handle_t
*
hcordic
)
¶
-
CORDIC Write data half complete callback.
Warning
This weak function must not be modified. When the callback is needed, it is overridden in the user file.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
-
void
HAL_CORDIC_ReadHalfCpltCallback
(
hal_cordic_handle_t
*
hcordic
)
¶
-
CORDIC Read data half complete callback.
Warning
This weak function must not be modified. When the callback is needed, it is overridden in the user file.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
-
void
HAL_CORDIC_WriteCpltCallback
(
hal_cordic_handle_t
*
hcordic
)
¶
-
CORDIC Write data complete callback.
Warning
This weak function must not be modified. When the callback is needed, it is overridden in the user file.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
-
void
HAL_CORDIC_AbortCpltCallback
(
hal_cordic_handle_t
*
hcordic
)
¶
-
Abort completed callback.
Warning
This weak function must not be modified. When the callback is needed, it is overridden in the user file.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
-
hal_status_t
HAL_CORDIC_RegisterErrorCallback
(
hal_cordic_handle_t
*
hcordic
,
hal_cordic_cb_t
p_callback
)
¶
-
Register a User CORDIC callback for Error.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_callback – Pointer to the callback function.
- Return values :
-
HAL_OK – Register completed successfully.
HAL_INVALID_PARAM – p_callback pointer is NULL.
-
hal_status_t
HAL_CORDIC_RegisterAbortCpltCallback
(
hal_cordic_handle_t
*
hcordic
,
hal_cordic_cb_t
p_callback
)
¶
-
Register a User CORDIC callback for DMA Abort complete.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_callback – Pointer to the callback function.
- Return values :
-
HAL_OK – Register completed successfully.
HAL_INVALID_PARAM – p_callback pointer is NULL.
-
hal_status_t
HAL_CORDIC_RegisterWriteCpltCallback
(
hal_cordic_handle_t
*
hcordic
,
hal_cordic_cb_t
p_callback
)
¶
-
Register a User CORDIC callback for write data complete.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_callback – Pointer to the callback function.
- Return values :
-
HAL_OK – Register completed successfully.
HAL_INVALID_PARAM – p_callback pointer is NULL.
-
hal_status_t
HAL_CORDIC_RegisterWriteHalfCpltCallback
(
hal_cordic_handle_t
*
hcordic
,
hal_cordic_cb_t
p_callback
)
¶
-
Register the CORDIC Write Half complete callback.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_callback – Pointer to the callback function.
- Return values :
-
HAL_OK – Register completed successfully.
-
hal_status_t
HAL_CORDIC_RegisterReadHalfCpltCallback
(
hal_cordic_handle_t
*
hcordic
,
hal_cordic_cb_t
p_callback
)
¶
-
Register the CORDIC Read Half complete callback.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_callback – Pointer to the callback function.
- Return values :
-
HAL_OK – Register completed successfully.
-
hal_status_t
HAL_CORDIC_RegisterCalculateCpltCallback
(
hal_cordic_handle_t
*
hcordic
,
hal_cordic_cb_t
p_callback
)
¶
-
Register a User CORDIC callback for calculation complete.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_callback – Pointer to the callback function.
- Return values :
-
HAL_OK – Register completed successfully.
HAL_INVALID_PARAM – p_callback pointer is NULL.
- group CORDIC_Exported_Functions_Group5
-
This section provides functions to:
Handle the CORDIC interrupt request with HAL_CORDIC_IRQHandler().
There are two ways to use callbacks: override weak callback functions or register user callback functions. They are used to indicate:
When all the computations are done (HAL_CORDIC_CalculateCpltCallback() or callback function registered with HAL_CORDIC_RegisterCalculateCpltCallback()).
When half of all the computations are read (HAL_CORDIC_ReadHalfCpltCallback() or callback function registered with HAL_CORDIC_RegisterReadHalfCpltCallback()).
When all the data have been written (HAL_CORDIC_WriteCpltCallback() or callback function registered with HAL_CORDIC_RegisterWriteCpltCallback()).
When half of all the data have been written (HAL_CORDIC_WriteHalfCpltCallback() or callback function registered with HAL_CORDIC_RegisterWriteHalfCpltCallback()).
When the abort is complete (HAL_CORDIC_AbortCpltCallback() or callback function registered with HAL_CORDIC_RegisterAbortCpltCallback()).
When an error occurs in the CORDIC driver (HAL_CORDIC_ErrorCallback() or callback function registered with HAL_CORDIC_RegisterErrorCallback()).
Depending on the process function you use, different callbacks might be triggered:
Process API
\
CallbacksHAL_CORDIC_Calculate_IT
HAL_CORDIC_CalculateCpltCallback
x
HAL_CORDIC_ErrorCallback
x
Process API
\
CallbacksHAL_CORDIC_Calculate_DMA
HAL_CORDIC_Write_DMA
HAL_CORDIC_Read_DMA
HAL_CORDIC_CalculateCpltCallback
x
x
HAL_CORDIC_WriteCpltCallback
x
x
HAL_CORDIC_ErrorCallback
x
x
x
Process API
\
CallbacksHAL_CORDIC_Write_DMA_opt
HAL_CORDIC_Read_DMA_opt
HAL_CORDIC_CalculateCpltCallback
x
HAL_CORDIC_WriteCpltCallback
x
HAL_CORDIC_ReadHalfCpltCallback*
x
HAL_CORDIC_WriteHalfCpltCallback*
x
HAL_CORDIC_ErrorCallback
x
x
Process API
\
CallbacksHAL_CORDIC_Abort_IT
HAL_CORDIC_AbortCpltCallback
x
Note
with HAL_CORDIC_OPT_DMA_IT_HALF_CPLT argument value for interrupts parameter
Functions
-
void
HAL_CORDIC_IRQHandler
(
hal_cordic_handle_t
*
hcordic
)
-
Handle CORDIC interrupt request.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
-
void
HAL_CORDIC_ErrorCallback
(
hal_cordic_handle_t
*
hcordic
)
-
CORDIC error callback.
Warning
This weak function must not be modified. When the callback is needed, it is overridden in the user file.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
-
void
HAL_CORDIC_CalculateCpltCallback
(
hal_cordic_handle_t
*
hcordic
)
-
CORDIC calculate complete callback.
Warning
This weak function must not be modified. When the callback is needed, it is overridden in the user file.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
-
void
HAL_CORDIC_WriteHalfCpltCallback
(
hal_cordic_handle_t
*
hcordic
)
-
CORDIC Write data half complete callback.
Warning
This weak function must not be modified. When the callback is needed, it is overridden in the user file.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
-
void
HAL_CORDIC_ReadHalfCpltCallback
(
hal_cordic_handle_t
*
hcordic
)
-
CORDIC Read data half complete callback.
Warning
This weak function must not be modified. When the callback is needed, it is overridden in the user file.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
-
void
HAL_CORDIC_WriteCpltCallback
(
hal_cordic_handle_t
*
hcordic
)
-
CORDIC Write data complete callback.
Warning
This weak function must not be modified. When the callback is needed, it is overridden in the user file.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
-
void
HAL_CORDIC_AbortCpltCallback
(
hal_cordic_handle_t
*
hcordic
)
-
Abort completed callback.
Warning
This weak function must not be modified. When the callback is needed, it is overridden in the user file.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
-
hal_status_t
HAL_CORDIC_RegisterErrorCallback
(
hal_cordic_handle_t
*
hcordic
,
hal_cordic_cb_t
p_callback
)
-
Register a User CORDIC callback for Error.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_callback – Pointer to the callback function.
- Return values :
-
HAL_OK – Register completed successfully.
HAL_INVALID_PARAM – p_callback pointer is NULL.
-
hal_status_t
HAL_CORDIC_RegisterAbortCpltCallback
(
hal_cordic_handle_t
*
hcordic
,
hal_cordic_cb_t
p_callback
)
-
Register a User CORDIC callback for DMA Abort complete.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_callback – Pointer to the callback function.
- Return values :
-
HAL_OK – Register completed successfully.
HAL_INVALID_PARAM – p_callback pointer is NULL.
-
hal_status_t
HAL_CORDIC_RegisterWriteCpltCallback
(
hal_cordic_handle_t
*
hcordic
,
hal_cordic_cb_t
p_callback
)
-
Register a User CORDIC callback for write data complete.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_callback – Pointer to the callback function.
- Return values :
-
HAL_OK – Register completed successfully.
HAL_INVALID_PARAM – p_callback pointer is NULL.
-
hal_status_t
HAL_CORDIC_RegisterWriteHalfCpltCallback
(
hal_cordic_handle_t
*
hcordic
,
hal_cordic_cb_t
p_callback
)
-
Register the CORDIC Write Half complete callback.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_callback – Pointer to the callback function.
- Return values :
-
HAL_OK – Register completed successfully.
-
hal_status_t
HAL_CORDIC_RegisterReadHalfCpltCallback
(
hal_cordic_handle_t
*
hcordic
,
hal_cordic_cb_t
p_callback
)
-
Register the CORDIC Read Half complete callback.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_callback – Pointer to the callback function.
- Return values :
-
HAL_OK – Register completed successfully.
-
hal_status_t
HAL_CORDIC_RegisterCalculateCpltCallback
(
hal_cordic_handle_t
*
hcordic
,
hal_cordic_cb_t
p_callback
)
-
Register a User CORDIC callback for calculation complete.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_callback – Pointer to the callback function.
- Return values :
-
HAL_OK – Register completed successfully.
HAL_INVALID_PARAM – p_callback pointer is NULL.
- group CORDIC_Exported_Functions_Group5
-
This section provides functions to:
Handle the CORDIC interrupt request with HAL_CORDIC_IRQHandler().
There are two ways to use callbacks: override weak callback functions or register user callback functions. They are used to indicate:
When all the computations are done (HAL_CORDIC_CalculateCpltCallback() or callback function registered with HAL_CORDIC_RegisterCalculateCpltCallback()).
When half of all the computations are read (HAL_CORDIC_ReadHalfCpltCallback() or callback function registered with HAL_CORDIC_RegisterReadHalfCpltCallback()).
When all the data have been written (HAL_CORDIC_WriteCpltCallback() or callback function registered with HAL_CORDIC_RegisterWriteCpltCallback()).
When half of all the data have been written (HAL_CORDIC_WriteHalfCpltCallback() or callback function registered with HAL_CORDIC_RegisterWriteHalfCpltCallback()).
When the abort is complete (HAL_CORDIC_AbortCpltCallback() or callback function registered with HAL_CORDIC_RegisterAbortCpltCallback()).
When an error occurs in the CORDIC driver (HAL_CORDIC_ErrorCallback() or callback function registered with HAL_CORDIC_RegisterErrorCallback()).
Depending on the process function you use, different callbacks might be triggered:
Process API
\
CallbacksHAL_CORDIC_Calculate_IT
HAL_CORDIC_CalculateCpltCallback
x
HAL_CORDIC_ErrorCallback
x
Process API
\
CallbacksHAL_CORDIC_Calculate_DMA
HAL_CORDIC_Write_DMA
HAL_CORDIC_Read_DMA
HAL_CORDIC_CalculateCpltCallback
x
x
HAL_CORDIC_WriteCpltCallback
x
x
HAL_CORDIC_ErrorCallback
x
x
x
Process API
\
CallbacksHAL_CORDIC_Write_DMA_opt
HAL_CORDIC_Read_DMA_opt
HAL_CORDIC_CalculateCpltCallback
x
HAL_CORDIC_WriteCpltCallback
x
HAL_CORDIC_ReadHalfCpltCallback*
x
HAL_CORDIC_WriteHalfCpltCallback*
x
HAL_CORDIC_ErrorCallback
x
x
Process API
\
CallbacksHAL_CORDIC_Abort_IT
HAL_CORDIC_AbortCpltCallback
x
Note
with HAL_CORDIC_OPT_DMA_IT_HALF_CPLT argument value for interrupts parameter
Functions
-
void
HAL_CORDIC_IRQHandler
(
hal_cordic_handle_t
*
hcordic
)
-
Handle CORDIC interrupt request.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
-
void
HAL_CORDIC_ErrorCallback
(
hal_cordic_handle_t
*
hcordic
)
-
CORDIC error callback.
Warning
This weak function must not be modified. When the callback is needed, it is overridden in the user file.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
-
void
HAL_CORDIC_CalculateCpltCallback
(
hal_cordic_handle_t
*
hcordic
)
-
CORDIC calculate complete callback.
Warning
This weak function must not be modified. When the callback is needed, it is overridden in the user file.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
-
void
HAL_CORDIC_WriteHalfCpltCallback
(
hal_cordic_handle_t
*
hcordic
)
-
CORDIC Write data half complete callback.
Warning
This weak function must not be modified. When the callback is needed, it is overridden in the user file.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
-
void
HAL_CORDIC_ReadHalfCpltCallback
(
hal_cordic_handle_t
*
hcordic
)
-
CORDIC Read data half complete callback.
Warning
This weak function must not be modified. When the callback is needed, it is overridden in the user file.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
-
void
HAL_CORDIC_WriteCpltCallback
(
hal_cordic_handle_t
*
hcordic
)
-
CORDIC Write data complete callback.
Warning
This weak function must not be modified. When the callback is needed, it is overridden in the user file.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
-
void
HAL_CORDIC_AbortCpltCallback
(
hal_cordic_handle_t
*
hcordic
)
-
Abort completed callback.
Warning
This weak function must not be modified. When the callback is needed, it is overridden in the user file.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
-
hal_status_t
HAL_CORDIC_RegisterErrorCallback
(
hal_cordic_handle_t
*
hcordic
,
hal_cordic_cb_t
p_callback
)
-
Register a User CORDIC callback for Error.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_callback – Pointer to the callback function.
- Return values :
-
HAL_OK – Register completed successfully.
HAL_INVALID_PARAM – p_callback pointer is NULL.
-
hal_status_t
HAL_CORDIC_RegisterAbortCpltCallback
(
hal_cordic_handle_t
*
hcordic
,
hal_cordic_cb_t
p_callback
)
-
Register a User CORDIC callback for DMA Abort complete.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_callback – Pointer to the callback function.
- Return values :
-
HAL_OK – Register completed successfully.
HAL_INVALID_PARAM – p_callback pointer is NULL.
-
hal_status_t
HAL_CORDIC_RegisterWriteCpltCallback
(
hal_cordic_handle_t
*
hcordic
,
hal_cordic_cb_t
p_callback
)
-
Register a User CORDIC callback for write data complete.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_callback – Pointer to the callback function.
- Return values :
-
HAL_OK – Register completed successfully.
HAL_INVALID_PARAM – p_callback pointer is NULL.
-
hal_status_t
HAL_CORDIC_RegisterWriteHalfCpltCallback
(
hal_cordic_handle_t
*
hcordic
,
hal_cordic_cb_t
p_callback
)
-
Register the CORDIC Write Half complete callback.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_callback – Pointer to the callback function.
- Return values :
-
HAL_OK – Register completed successfully.
-
hal_status_t
HAL_CORDIC_RegisterReadHalfCpltCallback
(
hal_cordic_handle_t
*
hcordic
,
hal_cordic_cb_t
p_callback
)
-
Register the CORDIC Read Half complete callback.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_callback – Pointer to the callback function.
- Return values :
-
HAL_OK – Register completed successfully.
-
hal_status_t
HAL_CORDIC_RegisterCalculateCpltCallback
(
hal_cordic_handle_t
*
hcordic
,
hal_cordic_cb_t
p_callback
)
-
Register a User CORDIC callback for calculation complete.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_callback – Pointer to the callback function.
- Return values :
-
HAL_OK – Register completed successfully.
HAL_INVALID_PARAM – p_callback pointer is NULL.
Error function ¶
- group CORDIC_Exported_Functions_Group6
-
This section permits retrieving at runtime the last error codes of the CORDIC peripheral with HAL_CORDIC_GetLastErrorCodes().
Functions
-
uint32_t
HAL_CORDIC_GetLastErrorCodes
(
const
hal_cordic_handle_t
*
hcordic
)
¶
-
Return the CORDIC peripheral error.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
- Return values :
-
uint32_t – This return value can be a combination of the following values:
-
uint32_t
HAL_CORDIC_GetLastErrorCodes
(
const
hal_cordic_handle_t
*
hcordic
)
¶
- group CORDIC_Exported_Functions_Group6
-
This section permits retrieving at runtime the last error codes of the CORDIC peripheral with HAL_CORDIC_GetLastErrorCodes().
Functions
-
uint32_t
HAL_CORDIC_GetLastErrorCodes
(
const
hal_cordic_handle_t
*
hcordic
)
-
Return the CORDIC peripheral error.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
- Return values :
-
uint32_t – This return value can be a combination of the following values:
-
uint32_t
HAL_CORDIC_GetLastErrorCodes
(
const
hal_cordic_handle_t
*
hcordic
)
- group CORDIC_Exported_Functions_Group6
-
This section permits retrieving at runtime the last error codes of the CORDIC peripheral with HAL_CORDIC_GetLastErrorCodes().
Functions
-
uint32_t
HAL_CORDIC_GetLastErrorCodes
(
const
hal_cordic_handle_t
*
hcordic
)
-
Return the CORDIC peripheral error.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
- Return values :
-
uint32_t – This return value can be a combination of the following values:
-
uint32_t
HAL_CORDIC_GetLastErrorCodes
(
const
hal_cordic_handle_t
*
hcordic
)
State function ¶
- group CORDIC_Exported_Functions_Group7
-
This section permits retrieving at runtime the state of the CORDIC peripheral using HAL_CORDIC_GetState().
Functions
-
hal_cordic_state_t
HAL_CORDIC_GetState
(
const
hal_cordic_handle_t
*
hcordic
)
¶
-
Return the CORDIC handle state.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
- Return values :
-
hal_cordic_state_t – CORDIC state.
-
hal_cordic_state_t
HAL_CORDIC_GetState
(
const
hal_cordic_handle_t
*
hcordic
)
¶
- group CORDIC_Exported_Functions_Group7
-
This section permits retrieving at runtime the state of the CORDIC peripheral using HAL_CORDIC_GetState().
Functions
-
hal_cordic_state_t
HAL_CORDIC_GetState
(
const
hal_cordic_handle_t
*
hcordic
)
-
Return the CORDIC handle state.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
- Return values :
-
hal_cordic_state_t – CORDIC state.
-
hal_cordic_state_t
HAL_CORDIC_GetState
(
const
hal_cordic_handle_t
*
hcordic
)
- group CORDIC_Exported_Functions_Group7
-
This section permits retrieving at runtime the state of the CORDIC peripheral using HAL_CORDIC_GetState().
Functions
-
hal_cordic_state_t
HAL_CORDIC_GetState
(
const
hal_cordic_handle_t
*
hcordic
)
-
Return the CORDIC handle state.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
- Return values :
-
hal_cordic_state_t – CORDIC state.
-
hal_cordic_state_t
HAL_CORDIC_GetState
(
const
hal_cordic_handle_t
*
hcordic
)
User Data and retrieve functions ¶
- group CORDIC_Exported_Functions_Group8
-
This section provides functions to set user-specific data to a CORDIC instance:
HAL_CORDIC_SetUserData(): Set user data in handler.
HAL_CORDIC_GetUserData(): Get user data from handler.
HAL_CORDIC_GetInstance(): Get the HAL CORDIC instance.
HAL_CORDIC_GetLLInstance(): Get the hardware CORDIC instance.
Functions
-
void
HAL_CORDIC_SetUserData
(
hal_cordic_handle_t
*
hcordic
,
const
void
*
p_user_data
)
¶
-
Store user data pointer into the handle.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_user_data – Pointer to the user data.
-
const
void
*
HAL_CORDIC_GetUserData
(
const
hal_cordic_handle_t
*
hcordic
)
¶
-
Retrieve user data pointer from the handle.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
- Return values :
-
void – Pointer to the user data.
-
hal_cordic_t
HAL_CORDIC_GetInstance
(
const
hal_cordic_handle_t
*
hcordic
)
¶
-
Get the CORDIC instance.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t structure.
- Return values :
-
HAL_CORDIC – HAL CORDIC instance.
-
CORDIC_TypeDef
*
HAL_CORDIC_GetLLInstance
(
const
hal_cordic_handle_t
*
hcordic
)
¶
-
Get the hardware CORDIC instance.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t structure.
- Return values :
-
CORDIC – CORDIC peripheral instance.
- group CORDIC_Exported_Functions_Group8
-
This section provides functions to set user-specific data to a CORDIC instance:
HAL_CORDIC_SetUserData(): Set user data in handler.
HAL_CORDIC_GetUserData(): Get user data from handler.
HAL_CORDIC_GetInstance(): Get the HAL CORDIC instance.
HAL_CORDIC_GetLLInstance(): Get the hardware CORDIC instance.
Functions
-
void
HAL_CORDIC_SetUserData
(
hal_cordic_handle_t
*
hcordic
,
const
void
*
p_user_data
)
-
Store user data pointer into the handle.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_user_data – Pointer to the user data.
-
const
void
*
HAL_CORDIC_GetUserData
(
const
hal_cordic_handle_t
*
hcordic
)
-
Retrieve user data pointer from the handle.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
- Return values :
-
void – Pointer to the user data.
-
hal_cordic_t
HAL_CORDIC_GetInstance
(
const
hal_cordic_handle_t
*
hcordic
)
-
Get the CORDIC instance.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t structure.
- Return values :
-
HAL_CORDIC – HAL CORDIC instance.
-
CORDIC_TypeDef
*
HAL_CORDIC_GetLLInstance
(
const
hal_cordic_handle_t
*
hcordic
)
-
Get the hardware CORDIC instance.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t structure.
- Return values :
-
CORDIC – CORDIC peripheral instance.
- group CORDIC_Exported_Functions_Group8
-
This section provides functions to set user-specific data to a CORDIC instance:
HAL_CORDIC_SetUserData(): Set user data in handler.
HAL_CORDIC_GetUserData(): Get user data from handler.
HAL_CORDIC_GetInstance(): Get the HAL CORDIC instance.
HAL_CORDIC_GetLLInstance(): Get the hardware CORDIC instance.
Functions
-
void
HAL_CORDIC_SetUserData
(
hal_cordic_handle_t
*
hcordic
,
const
void
*
p_user_data
)
-
Store user data pointer into the handle.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
p_user_data – Pointer to the user data.
-
const
void
*
HAL_CORDIC_GetUserData
(
const
hal_cordic_handle_t
*
hcordic
)
-
Retrieve user data pointer from the handle.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t.
- Return values :
-
void – Pointer to the user data.
-
hal_cordic_t
HAL_CORDIC_GetInstance
(
const
hal_cordic_handle_t
*
hcordic
)
-
Get the CORDIC instance.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t structure.
- Return values :
-
HAL_CORDIC – HAL CORDIC instance.
-
CORDIC_TypeDef
*
HAL_CORDIC_GetLLInstance
(
const
hal_cordic_handle_t
*
hcordic
)
-
Get the hardware CORDIC instance.
- Parameters :
-
hcordic – Pointer to a hal_cordic_handle_t structure.
- Return values :
-
CORDIC – CORDIC peripheral instance.